Add configurable caching strategies for Motif scopes - #276
Merged
Conversation
rysh88
force-pushed
the
feature/motif-caching-strategies
branch
2 times, most recently
from
July 21, 2026 19:04
7721d26 to
a860619
Compare
yhartanto
approved these changes
Jul 23, 2026
| strategy: | ||
| matrix: | ||
| java_version: [11] | ||
| java_version: [17] |
There was a problem hiding this comment.
We use 21 in internal repos now but okay to leave it as is
| .build() | ||
| } else { | ||
| // SMART_CACHE: Use null initialization | ||
| FieldSpec.builder(Object::class.java, name, Modifier.PRIVATE, Modifier.VOLATILE).build() |
There was a problem hiding this comment.
What if the type is a kotlin non-nullable type
Collaborator
Author
- Add CachingStrategy enum (NONE, BASELINE, BASELINE_WITH_LOCK_SELECTABLE) - Add DoNotCache annotation and MotifRuntimeConfig for runtime config - Add MotifLock for per-dependency locking support - Generate caching code based on strategy in Java/Kotlin code generators - Fix CI: upgrade Java 11 → 17 (required by AGP 7.4.2) - Fix google-java-format 1.8 → 1.17.0 (required by Java 17) - Fix AndroidManifest package attribute conflicts with namespace - Fix dagger-comparison R import to match namespace Co-Authored-By: Claude
rysh88
force-pushed
the
feature/motif-caching-strategies
branch
from
July 28, 2026 11:51
a860619 to
48a3dbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description:
Introduce four opt-in caching strategies, selectable per
@Scope, so applications can tune dependency-caching behavior. Default behavior (BASELINE) is unchanged.Strategies (
motif.CachingStrategy):None.NONEsentinel +synchronized(this)MotifRuntimeConfig.usePerDependencyLock)MotifRuntimeConfig.cachingStrategy— switchable at runtime, making it A/B-test friendlyOther changes:
MotifRuntimeConfig,MotifLock,CachingStrategy@DoNotCachegainsonlyForSmartCacheMode()for strategy-specific opt-outJavaCodeGenerator/KotlinCodeGeneratorBaselineCodegenTestguards BASELINE codegen byte-for-byte against driftRelated issue(s):
Test plan: Unit tests, including concurrency tests (latch handshake for deterministic lock verification, 16-thread contention test for double-checked locking).
Revert plan: Opt-in per
@ScopeviaCachingStrategy; default is BASELINE.